<template>
    <div ref="body">
        <Form :label-width="120" inline>
            <Form-item label="小区名称:">
                <Input v-model="queryParam.cmcg0002" placeholder="请输入小区名称" style="width:200px"/>
            </Form-item>

            <Form-item label="小区地址:">
                <Input v-model="queryParam.cmcg0003" placeholder="请输入小区地址" style="width:200px"/>
            </Form-item>
            <Row class="button_row">
                 <span style="float: left;">
                <Button type="primary" @click="handleAdd()">新增</Button>
                </span>
                <span style="float: right;">
                 <Button type="primary" @click="searchQuery">查询</Button>
                 <Button type="primary" class="button_item_left" @click="searchReset">重置</Button>
            </span>
            </Row>
        </Form>

        <div class="table_div">
            <vxe-table border
                       auto-resize
                       row-id="id"
                       :row-key="true"
                       show-overflow="tooltip"
                       highlight-hover-row
                       align="center"
                       header-align="center"
                       ref="xTree"
                       :loading="Loading"
                       :data="tableData">
                <vxe-table-column field="cmcg0001" title="所属社区" align="center" min-width="300"
                                  :formatter="renderAreaName"/>
                <vxe-table-column field="cmcg0002" title="小区名称" align="center" width="200"/>
                <vxe-table-column field="cmcg0003" title="小区地址" align="center" width="300"/>
                <vxe-table-column field="delFlag" title="有效状态" align="center" width="220" :formatter="renderDelFlag"/>
                <vxe-table-column title="操作" align="center" width="350" fixed="right">
                    <template #default="{row}">
                        <Button type="info" size="small" @click="handleEdit(row)" v-if="row.delFlag=='0'"  style="margin-right: 5px">编辑
                        </Button>
                        <Button type="success" size="small" @click="handleDetail(row)"  style="margin-right: 5px">详情
                        </Button>
                        <Button type="error" size="small" @click="handleDelete(row.id)" v-if="row.delFlag=='0'">删除
                        </Button>
                    </template>
                </vxe-table-column>
            </vxe-table>
            <Page :total="dataCount" :page-size="pageSize" show-total class="paging"
                  @on-change="handleTableChange" :current="pageNo"></Page>
        </div>
        <ss01004-modal ref="modalForm" @ok="modalFormOk"/>
    </div>
</template>
<script>
    import {CommonMixin} from '@/views/common/js/CommonMixin'
    import Ss01004Modal from './modules/ss01004Modal'


    export default {
        name: "ss01004List",
        mixins: [CommonMixin],
        components: {Ss01004Modal},
        data() {
            return {
                url: {
                    list: "/api/ac/subsistence/ss01004Service/page",
                    delete: "/api/ac/subsistence/ss01004Service/delete",
                },
                Loading: true,
                queryParam: {},

            }
        },
        methods: {
            renderDelFlag(h) {
                if (h.cellValue == '0') {
                    return "无效";
                } else {
                    return "有效"
                }
            }
        },
        created() {
            this.findAreaList();
        },
    }
</script>

<style scoped>

</style>
